The CContextHandler class encapsulates AppleGuide context checking for PowerPlant applications. It uses a single ContextReplyProc to dispatch context checks to specific context checking objects. Two useful subclasses are provided for checking the enabled state of commands and the front window's pane id. These context checks are more powerful than the kinds of context checking that can be done from external modules because they don't depend on menu item text or position or on window title or size.
This class may be freely used in any project. The source itself may not be sold. The source may be placed on ftp sites, BBSs, and similar locations but distribution on solid media, CD, floppy, etc, requires my permission.
Usage:
(1) During application startup create the context checking objects like this:
Try_{
new CCmdContextHandler( 'cmd ' );
new CPaneIDContextHandler( 'pane' );
} Catch_( inErr ) {
} EndCatch_
(2) In your guide file source, define the context checks like this:
<Define Context Check> "IsCommandEnabled", 'cmd ', '????', LONG
<Define Context Check> "IsFrontWindowPaneID", 'pane', '????', LONG
where '????' is replaced by your application's creator.
(3) And finally use it in your guide source like any other context check.
Note: when you compile your guide source GuideMaker will give you a warning that there's no external module for the context checks you've defined. Just ignore it.